tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
authorBen Hutchings <ben@decadent.org.uk>
Tue, 11 Sep 2018 01:38:36 +0000 (02:38 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 15 May 2019 22:07:16 +0000 (23:07 +0100)
commit53c830e6b21f680f5db6dc0731f7d53efc46ac69
tree7047ee6d8a9e32cb8bdee192d50d7b1aed96ce4b
parent5901160502bfb89c4e27e5ef000875d09fffda34
tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

x86_energy_perf_policy first uses __get_cpuid() to check the maximum
CPUID level and exits if it is too low.  It then assumes that later
calls will succeed (which I think is architecturally guaranteed).  It
also assumes that CPUID works at all (which is not guaranteed on
x86_32).

If optimisations are enabled, gcc warns about potentially
uninitialized variables.  Fix this by adding an exit-on-error after
every call to __get_cpuid() instead of just checking the maximum
level.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-x86_energy_perf_policy-fix-uninitialized-varia.patch
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c